
$(document).ready(function(){
    /*
        头部按钮
     */
    /*
        点击空白处隐藏div
     */
    $(function(){
        $("#bttun").click(function(event){
            var e=window.event || event;
            if(e.stopPropagation){
                e.stopPropagation();
            }else{
                e.cancelBubble = true;
            }
            $(".search_kuang").css("display","block");
        });
        $("#box").click(function(event){
            var e=window.event || event;
            if(e.stopPropagation){
                e.stopPropagation();
            }else{
                e.cancelBubble = true;
            }
        });
        document.onclick = function(){
            $(".search_kuang").css("display","none");
        };
    })

    /*
     *大家搜索
     */
    $(".search_kuang_ul>li").mouseenter(function () {
        var i=$(this).index();
        $(".search_kuang_ul>li").css("background-color","#fff");
        $(".search_kuang_ul>li>div").css( "border-bottom","1px dashed #d9d9d9");
        $(this).css({
            "background-color":"#ffeef1",
        }) ;

        $(".search_kuang_ul li> div").eq(i+1).css({
            "border-bottom": "1px dashed #fff"
        })
        $(".search_kuang_ul li> div").eq(i).css({
            "border-bottom": "1px dashed #fff"
        })
    })
    $(".search_kuang_ul li >div>div").mouseenter(function () {

        if($(".search_kuang_ul li div>div").hasClass("search_kuang_active")){

        }else{
            $(".search_kuang_ul li div>div").addClass("search_display");
        }

        var i=$(this).index();
        $(this).removeClass("search_display");
        alert($(this).tagName)
    })
    /*
            中部图片左的轮播图
     */
    $("#yuan>li").click(function () {
        $("#yuan>li").css({
            "background":"#d9d9d9",
            "width":"10px",
            "border-color":"#d9d9d9",
            "border-radius" : "10px",
            "webkit-border-radius":"10px",
            " -moz-border-radius" : "10px"
        });
        $(this).css({
            "background":"#fd113a",
            "border-color":"#fd113a",
            "width":"25px",
            "border-radius" : "10px",
            "webkit-border-radius":"10px",
            " -moz-border-radius" : "10px"
        });

    })

/*
    精品轮播列表
 */
    $("#slide_list ol>li").click(function () {
        $("#slide_list ol>li").css({
            "background":"#d9d9d9",
            "width":"10px",
            "border-color":"#d9d9d9",
            "border-radius" : "10px",
            "webkit-border-radius":"10px",
            " -moz-border-radius" : "10px"
        });
        $(this).css({
            "background":"#fd113a",
            "border-color":"#fd113a",
            "width":"25px",
            "border-radius" : "10px",
            "webkit-border-radius":"10px",
            " -moz-border-radius" : "10px"
        });
    });

    /*
    最新
     */
    $(".recently>header>ul>li ").mouseenter(function () {
         var i=$(this).index();
        $(".recently>header>ul style").remove();
        $(".recently>header>ul>li>a").removeClass("b_c1");
       $(this).append("<style>.recently header ul li:nth-child("+(i+1)+") a:after\n" +
           "{\n" +
           "    background-color: #fd113a;\n" +
           "    height: 4px;\n" +
           "    border-radius: 2px;\n" +
           "    display: block;\n" +
           "    width: 80%;\n" +
           "    margin: 0 auto;\n" +
           "    margin-top: -8px;\n" +
           "    content: '';\n" +
           "}</style>")
        $(".recently>div>.recently_img").eq(i).show().siblings().hide();
    })

    /*
        轮播图时间
     */
    $('#myCarousel').carousel({interval:2000});//每隔2秒自动轮播

    /*
        周排行TOP50选项卡
     */
    $(".ranking_top_left>ul>li").mouseenter(function () {
        var i=$(this).index();
        $(".ranking_top_left>ul>li").removeClass("active_color");
        $(this).addClass("active_color");
        $(".ranking_top_right>div").eq(i).show().siblings().hide();
    })

    /*
        分类
     */
    $(".classify_img_carousel_top>a").click(function(){
        var j=$(this).index();
        var i=30;
        $(".classify_img_carousel_top>a").removeAttr("href");
           if($(this).is(".classify_img_carousel_top_1")){
               i=i+130
               var c2=$(".classify_img_carousel_top_2").animate({
                   opacity:'1',
                   top:"20px",
                   left:290+'px',
                   width: "197px",
                   height: "260px",
                   "z-index":"1",
                   speed:"20"

               },150);
               var c1= $(this).animate({
                   opacity:'1',
                   top:'0px',
                   left:i+'px',
                   width:"230px",
                   height: "310px",
                   "z-index":"2",
                   "border-width":"10px",
                   speed:"20"
               },150);

              var c3= $(".classify_img_carousel_top_3").animate({
                  opacity:'1',
                  left:0+'px',
                   width: "197px",
                   height: "260px",
                  "z-index":"1",
                  speed:"20"
               },150);
               $(".classify_img_carousel_top_2").attr("href","true");
                c1.removeClass("classify_img_carousel_top_1").addClass("classify_img_carousel_top_2");
                c2.removeClass("classify_img_carousel_top_2").addClass("classify_img_carousel_top_3");
                c3.removeClass("classify_img_carousel_top_3").addClass("classify_img_carousel_top_1");

           }
           if($(this).is(".classify_img_carousel_top_3"))
           {
               var c1=$(".classify_img_carousel_top_2").animate({
                   opacity:'1',
                   top:'20px',
                   left:0+'px',
                   width: "197px",
                   height: "260px",
                   "z-index":"1",
                   "border-width":"10px",
                   speed:"20"

               },150);
               var c2= $(this).animate({
                   opacity:'1',
                   top:"0px",
                   left:160+'px',
                   width:"230px",
                   height: "310px",
                   "z-index":"2",
                   speed:"20"
               },150);

               var c3= $(".classify_img_carousel_top_1").animate({
                   opacity:'1',
                   left:290+'px',
                   width: "197px",
                   top:"20px",
                   height: "260px",
                   "z-index":"1",
                   speed:"20"
               },150);
               $(".classify_img_carousel_top_2").attr("href","true");
               c1.removeClass("classify_img_carousel_top_2").addClass("classify_img_carousel_top_1");
               c2.removeClass("classify_img_carousel_top_3").addClass("classify_img_carousel_top_2");
               c3.removeClass("classify_img_carousel_top_1").addClass("classify_img_carousel_top_3");

           }

        $(".classify_img_carousel_b>div").eq(j).show().siblings().hide();

    });
});
